package com.itheima.service;

import com.itheima.mapper.UserMapper;
import com.itheima.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;

    public User queryUserById(Long id) {
        return userMapper.selectByPrimaryKey(id);
    }

    public List<User> queryAllUsers() {
        return userMapper.selectAll();
    }

    public int createUser(User user) {
        return userMapper.insert(user);
    }
}
